package de.bk.timecalc.midlet.statemachine;

import javax.microedition.lcdui.Form;

import de.bk.timecalc.midlet.Commands;

public class GuiStateStart extends AbstractGuiState
{
  private Form form;

  GuiStateStart(StateMachine stateMachine)
  {
    super(stateMachine);
  }

  public void init()
  {
    this.createForm();
  }

  public void enter()
  {
    this.getDisplay().setCurrent(this.form);
  }

  public void destroy()
  {
    this.form = null;
  }

  private void createForm()
  {
    this.form = new Form("QL Time Calc Trainer");
    CommandListenerStart commandListener = new CommandListenerStart(this);
    this.form.setCommandListener(commandListener);
    this.form.addCommand(Commands.start);
    this.form.addCommand(Commands.help);
    this.form.addCommand(Commands.options);
    this.form.addCommand(Commands.exit);
  }
}
